<?php if ($this->pageCount > 1): ?>
    <div class="pagin">
        <ul>

            <!-- First page link -->

            <?php if (isset($this->first) && ($this->first != '1')): ?>     
                <li>
                    <a 
                        rel="prettyPhoto[ajax]" 
                        name="view_message"
                        onclick="jQuery.prettyPhoto.openAjax('', '<?php echo $this->url(array('page' => $this->first)); ?>?ajax=true')"
                        >
                        First
                    </a>     
                </li> 
            <?php endif; ?>     


            <!-- Previous page link -->
            <?php if (isset($this->previous)) { ?>
                <li>
                    <a 
                        rel="prettyPhoto[ajax]" 
                        name="view_message"
                        onclick="jQuery.prettyPhoto.openAjax('', '<?php echo $this->url(array('page' => $this->previous)); ?>?ajax=true')"
                        >
                        &laquo;
                    </a>
                </li>
            <?php } ?>


            <!-- Numbered page links -->
            <?php foreach ($this->pagesInRange as $page): ?>
                <?php if ($page != $this->current): ?>
                    <li>
                        <a 
                            rel="prettyPhoto[ajax]" 
                            name="view_message"
                            onclick="jQuery.prettyPhoto.openAjax('', '<?php echo $this->url(array('page' => $page)); ?>?ajax=true')"
                            >
                                <?php echo $page; ?>
                        </a></li>
                <?php else: ?>
                    <li class="cur"><a href="#"><?php echo $page; ?></a></li>

                <?php endif; ?>
            <?php endforeach; ?>
            <!-- Next page link -->
            <?php if (isset($this->next)) { ?>
                <li>
                    <a 
                        rel="prettyPhoto[ajax]" 
                        name="view_message"
                        onclick="jQuery.prettyPhoto.openAjax('', '<?php echo $this->url(array('page' => $this->next)); ?>?ajax=true')"
                        >
                        &raquo;
                    </a></li>
            <?php } ?>


            <!-- Last page link -->

            <?php if (isset($this->last) && ($this->last != $this->pageCount)): ?>
                <li>
                    <a 
                        rel="prettyPhoto[ajax]" 
                        name="view_message"
                        onclick="jQuery.prettyPhoto.openAjax('', '<?php echo $this->url(array('page' => $this->last)); ?>?ajax=true')"
                        >
                        Last
                    </a>
                </li>
            <?php endif; ?>


        </ul>
        <div class="cl"></div>
    </div>
<?php endif; ?>
